import showMessage from "@/utils/showMessage";
import axios from "axios";

const ins = axios.create();  // 创建一个axios的实例
ins.interceptors.response.use(function (response) {
  if(response.data.code !== 0) {
    showMessage({
      content: response.data.msg,
      type: "error",
      duration: 2000,
    });
    return null;
  }
  return response.data.data;
});

export default ins;